From: Alexandre Emsenhuber Date: Thu, 17 Apr 2008 19:56:31 +0000 (+0000) Subject: This is a bit weired but... Don't throw a MySQL error if revision table is empty X-Git-Tag: 1.31.0-rc.0~48223 X-Git-Url: http://git.cyclocoop.org/%22.%24info%5B?a=commitdiff_plain;h=1d82660ace32e43897f02af1efbf2ecb9f530dd0;p=lhc%2Fweb%2Fwiklou.git This is a bit weired but... Don't throw a MySQL error if revision table is empty --- diff --git a/maintenance/populateParentId.php b/maintenance/populateParentId.php index 4b73070eed..366c457c2b 100644 --- a/maintenance/populateParentId.php +++ b/maintenance/populateParentId.php @@ -22,6 +22,14 @@ function populate_rev_parent_id( $db ) { echo "Populating rev_parent_id column\n"; $start = $db->selectField( 'revision', 'MIN(rev_id)', false, __FUNCTION__ ); $end = $db->selectField( 'revision', 'MAX(rev_id)', false, __FUNCTION__ ); + if( is_null( $start ) || is_null( $end ) ){ + echo "...revision table seems to be empty.\n"; + $db->insert( 'updatelog', + array( 'ul_key' => 'populate rev_parent_id' ), + __FUNCTION__, + 'IGNORE' ); + return; + } # Do remaining chunk $end += BATCH_SIZE - 1; $blockStart = $start;